package com.teach.ser;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.ObjectInputStream;

/**
 * <pre>
 * - 反序列化 deserialization
 * Author : J.L.Zhou
 * E-Mail : 2233875735@qq.com
 * Tel : 151 1104 7708
 * Date : 2021-4-27 10:02:23
 * Version : 1.0
 * Copyright 2021 jlzhou.top Inc. All rights reserved.
 * Warning: this content is only for internal circulation of the company.
 *          It is forbidden to divulge it or use it for other commercial purposes.
 * </pre>
 */
public class StreamToObject {

	public static void main(String[] args)throws Exception {
		File file = new File("d:/upload/object");
		Student stu = null;
		try(
			InputStream in = new FileInputStream(file);
			ObjectInputStream oin = new ObjectInputStream(in);
				){
			Object obj = oin.readObject();
			stu = (Student)obj;
		}
		
		System.out.println(stu);
	}
}
